package com.itheima.array;

import java.util.Scanner;

public class PingWeiDaFen {
    public static void main(String[] args) {
        int[] nums = new int[6];
        Scanner sc = new Scanner(System.in);

        for (int i = 0; i < nums.length; i++) {
            System.out.println("请输入第"+(i+1)+"个评委打分");
            int x = sc.nextInt();
            if (x >= 0 && x<=100){
                nums[i] = x;
            }else{
                System.out.println("您的输入有误,请重新输入:");
                i--;
            }
        }

        int sum = 0;
        int max = nums[0];
        int min = nums[0];
        for (int i = 0; i < nums.length; i++) {
            if(max < nums[i]){
                max = nums[i];
            }

            if(min > nums[i]){
                min = nums[i];
            }

            sum += nums[i];
        }

        int deFen = (sum - max - min)/4;
        System.out.println("最后得分:"+deFen);
    }
}
